package com.sky.controller.admin;


import com.sky.result.Result;
import com.sky.service.ShopService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Api(value = "店铺相关接口")
@Slf4j
public class ShopController {
    @Autowired
    private ShopService shopService;

    @PutMapping("/{status}")
    @ApiOperation(value = "设置店铺状态")
    public Result<String> setStatus(@PathVariable Integer status){
        log.info("设置店铺状态:{}",status);
        String res=  shopService.setStatus(status);
        return null;
    }


    @GetMapping("/status")
    @ApiOperation(value = "获取店铺状态")
    public Result<Integer> getStatus(){
        Integer status=shopService.getStatus();
        log.info("获取店铺状态:{}",status==1?"营业中":"打烊中");

        return Result.success(status);
    }
}
